package com.example.cms.service.Impl;

import com.example.cms.dao.CoursesDao;
import com.example.cms.entity.Courses;
import com.example.cms.service.CoursesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("CoursesService")
@Transactional
public class CoursesServiceImpl implements CoursesService {

    @Autowired
    private CoursesDao coursesDao;

    @Override
    public List<Courses> getCourses() {
        return coursesDao.selectCourses();
    }

    @Override
    public Integer getNum() {
        return coursesDao.getNum();
    }

    @Override
    public Integer removeCourses(Integer coursesId) {
        return coursesDao.deleteCourses(coursesId);
    }

    @Override
    public Integer editCourses(Courses courses) {
        return coursesDao.updateCourses(courses);
    }

    @Override
    public Integer addCourses(Courses courses) {
        return coursesDao.insertCourses(courses);
    }
}
